package com.tsky.yyj.entity;

import java.sql.Timestamp;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @function：商品（优惠劵），核心
 * @author: cainiao
 * @version 1.0
 * @time: 2013-6-10 上午10:28:57
 */
@Entity
@Table(name = "T_YYJ_Product")
public class Product {
	@Id
	private String id;// 序号
	@ManyToOne @JoinColumn(name="type_id")
	private Classify type;// @所属子分类
	@ManyToOne @JoinColumn(name="store_id")
	private Store store;// @所属门店【Y】---> 所属商家/所属区域
	private String title;// 优惠券标题【Y】
	private String description;// 优惠券内容
	private float price;// 价格（积分/金币）【Y】
	private int quantity;// 数量【Y】
	private float discount;// 折扣【Y】
	private String beginDate;// $开始时间【Y】
	private String endDate;// $截止时间【Y】
	private Timestamp pubDate;// 上线时间【Y】
	private String image;// #优惠券图片（上传图片）【Y】
	@OneToOne @JoinColumn(name="agreement_id")
	private Agreement agreement;// #合同信息
	private String status = "0";// 状态（0：审核中、1：在线、2：下线）
	private String leaveMoney;// 剩余金币数{初始值 = price * quantity}
	private int collect;// 被收藏数
	
	@OneToMany(mappedBy = "product")
	private List<Spread> spreads;// @推广信息【代理商用户名、代理推广点击IP明细、会员使用次数】
	@OneToMany(mappedBy = "product")
	private List<Receive> receives;// @被领取明细【序号、用户名、优惠券状态（未使用、已使用）】

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Timestamp getPubDate() {
		return pubDate;
	}

	public void setPubDate(Timestamp pubDate) {
		this.pubDate = pubDate;
	}

	public Classify getType() {
		return type;
	}

	public void setType(Classify type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(String beginDate) {
		this.beginDate = beginDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	public Agreement getAgreement() {
		return agreement;
	}

	public void setAgreement(Agreement agreement) {
		this.agreement = agreement;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getLeaveMoney() {
		return leaveMoney;
	}

	public void setLeaveMoney(String leaveMoney) {
		this.leaveMoney = leaveMoney;
	}

	public List<Spread> getSpreads() {
		return spreads;
	}

	public void setSpreads(List<Spread> spreads) {
		this.spreads = spreads;
	}

	public List<Receive> getReceives() {
		return receives;
	}

	public void setReceives(List<Receive> receives) {
		this.receives = receives;
	}

	public int getCollect() {
		return collect;
	}

	public void setCollect(int collect) {
		this.collect = collect;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public float getDiscount() {
		return discount;
	}

	public void setDiscount(float discount) {
		this.discount = discount;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

}
